package com.binhthuan.catechist.client.data;

import com.binhthuan.catechist.shared.constant.Parameter;
import com.binhthuan.catechist.shared.constant.Service;
import com.smartgwt.client.data.fields.DataSourceDateField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class YearDS extends AbstractDS {

    private static YearDS instance;

    private YearDS() {
        super(Service.YEAR);

        DataSourceIntegerField idField = new DataSourceIntegerField(Parameter.ID);
        idField.setHidden(true);
        idField.setPrimaryKey(true);

        DataSourceDateField startDayField = new DataSourceDateField(Parameter.START_DATE);

        DataSourceDateField endDayField = new DataSourceDateField(Parameter.END_DATE);

        DataSourceTextField descriptionField = new DataSourceTextField(Parameter.DESCRIPTION);

        setFields(idField, startDayField, endDayField, descriptionField);
    }


    public static YearDS getInstance() {
        if (instance == null) {
            instance = new YearDS();
        }

        return instance;
    }
}
